<h1>Listing tasks</h1>

<table>
  <tr>
  <% for column in Task.content_columns %>
    <th><%= column.human_name %></th>
  <% end %>
  </tr>
  
<% for task in @tasks %>
  <tr>
  <% for column in Task.content_columns %>
    <td><%=h task.send(column.name) %></td>
  <% end %>
    <td><%= link_to 'Show', :action => 'show', :id => task %></td>
    <td><%= link_to 'Edit', :action => 'edit', :id => task %></td>
    <td><%= link_to 'Destroy', { :action => 'destroy', :id => task }, :confirm => 'Are you sure?', :method => :post %></td>
  </tr>
<% end %>
</table>

<%= link_to 'Previous page', { :page => @task_pages.current.previous } if @task_pages.current.previous %>
<%= link_to 'Next page', { :page => @task_pages.current.next } if @task_pages.current.next %> 

<br />

<%= link_to 'New task', :action => 'new' %>
